#include <stdio.h>

int main(int argc, const char *argv[]) {
    
    int n, ot, ct, t, v, ans, i;

    while (1) {
        scanf("%d", &n);
        if (-1 == n) {
            break;
        }
        ans = 0;
        ot = 0;
        for (i = 0; i < n; i++) {
            scanf("%d %d", &v, &ct);
            t = ct - ot;
            ans += v * t;
            ot = ct;
        }

        printf("%d miles\n", ans);
    }

    return 0;
}
